package com.boliq.demo.receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

import blq.ssnb.snbutil.SnbLog;
import blq.ssnb.snbutil.SnbToast;

/**
 * <pre>
 * ================================================
 * 作者: BLQ_SSNB
 * 日期：2021/2/26
 * 邮箱: blq_ssnb@outlook.com
 * 修改次数: 1
 * 描述:
 *      添加描述
 * ================================================
 * </pre>
 */
public class SequenceReceiver extends BroadcastReceiver {
    private static final String TAG = "SequenceReceiver";

    @Override
    public void onReceive(Context context, Intent intent) {
        String msg = intent.getStringExtra("msg");
        int index = intent.getIntExtra("index", -1);
        String log = TAG + "\n接收Action:" + intent.getAction() + "\n消息:" + msg + ";index:" + index;
        SnbToast.showSmart(context, log);
        SnbLog.e(">>>>>>>>广播接收:" + log);
        if (index != -1) {
            abortBroadcast();
            SnbToast.showSmart(context, TAG + ":我这里拦截了");
        }
    }
}
